home *** CD-ROM | disk | FTP | other *** search
- Path: diku.dk!null
- From: null@diku.dk (Niels Ull Jacobsen)
- Newsgroups: comp.os.ms-windows.programmer.tools.mfc,comp.os.ms-windows.apps.compatibility.win95,comp.lang.c++
- Subject: Re: HELP - CString conversion?
- Date: 28 Jan 1996 11:54:06 GMT
- Organization: Department of Computer Science, U of Copenhagen
- Sender: null@tyr.diku.dk
- Message-ID: <4efo4u$2ve@odin.diku.dk>
- References: <NEWTNews.16531.822443361.Postmaster@Jerusalem.netvision.net.il> <4ea0gm$eka@basfigw.basf-corp.com>
- NNTP-Posting-Host: odin.diku.dk
- X-Newsreader: NN version 6.5.0 #13
-
- Adler <Andreas.Adler@zxa.x400.basf-ag.de> writes:
-
- >iti@Jerusalem.netvision.net.il wrote:
- >>
- >>When I try to read the text from a Edit Control (IDC_EDIT1) with the
- >>following code:
- >>
- >>--------------------------------------------------------------
- >>CString callBuf;
- >>int msgLen = GetDlgItemText(IDC_EDIT1, callBuf, sizeof(callBuf));
- >>--------------------------------------------------------------
- >>
- >>I get the following error:
- >>
- >>--------------------------------------------------------------
- >>error C2664: 'GetDlgItemText' : cannot convert parameter 2 from 'class >::CString ' to 'char __far *'
- >>--------------------------------------------------------------
-
- >try:
- > #define MAXLEN 256
- > CString callBuf;
- > LPTSTR p;
- > int msgLen;
-
- > p=callBuf.GetBuffer(MAXLEN);
- > msgLen = GetDlgItemText(IDC_EDIT1, p, MAXLEN);
- > callBuf.ReleaseBuffer();
-
- Totally correct. Of course, you could just use the somewhat simpler
-
- msgLen = GetDlgItemText(IDC_EDIT1, callBuf);
-
-
-
-
-
- >Andreas Adler
-
-
- --
- Niels Ull Jacobsen, Dep. of CS, U of Copenhagen (null@diku.dk)
- Roenne Alle 3 st.th, 2860 Soeborg, Denmark, tel. +45 39 66 39 86
-
-